package main

import (
	"flag"
	"github.com/chicken-team-outside/chicken_transmission/proxy_server/api"
	"github.com/chicken-team-outside/chicken_transmission/proxy_server/email_server"
	"github.com/chicken-team-outside/chicken_transmission/proxy_server/model"
	"github.com/chicken-team-outside/chicken_transmission/proxy_server/setting"
	"go.uber.org/zap"
)

func main() {
	var configPath string
	flag.StringVar(&configPath, "c", "config/config.ini", "application config path")
	flag.Parse()
	for _, initFunc := range []func() error{
		func() error {
			return setting.Init(configPath)
		},
		model.Init,
		email_server.Init,
		api.Run,
	} {
		if err := initFunc(); err != nil {
			zap.L().Fatal("init server failed", zap.Error(err))
		}
	}
}
